package com.example.back.mapper;

import com.example.back.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(userId,useredId,text,time,url) values(#{userId},#{useredId},#{text},#{time},#{url})")
    int addComment(Comment comment);
    @Delete("delete from comment where id=#{id}")
    int deleteComment(Integer id);
    @Update("update comment set userId=#{userId},useredId=#{useredId},text=#{text},time=#{time},url=#{url} where id=#{id}")
    int updateComment(Comment comment);
    @Select("select * from comment where id=#{id}")
    Comment queryCommentById(Integer id);
    @SelectProvider(type = CommentMapperProvider.class, method = "getQueryCommentsSql")
    ArrayList<Comment> queryComments(Comment comment);
}
